package View;

import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.*;

import DAO.AddClass;
import DAO.AddCourse;
import DAO.AddStudent;
import DAO.DelClass;
import DAO.DelCourse;
import DAO.DelStudent;
import DAO.QueryByClass;
import DAO.ShowAll;

public class AdminFrame extends JFrame{
	private JPanel contentPane=new JPanel();
	private JMenuBar menuBar;
	private JMenu Student,Class,Subject,Score;
	private JMenuItem addStuItem,delStuItem,addClassItem,delClassItem,addCourseItem,delCourseItem,queryOne,queryAll,queryCourse;
	    
	     public AdminFrame(){
	    	setTitle("管理员模式");
			setSize(400,400);
			this.setLocationRelativeTo(null);
			
			JMenuBar menuBar=new JMenuBar();
			Student=new JMenu("学生管理");
			Student.setFont(new Font("楷体", Font.BOLD, 16));
			Class=new JMenu("班级管理");
			Class.setFont(new Font("楷体", Font.BOLD, 16));
			Subject=new JMenu("科目管理");
			Subject.setFont(new Font("楷体", Font.BOLD, 16));
			Score=new JMenu("成绩管理");
			Score.setFont(new Font("楷体", Font.BOLD, 16));
			addStuItem=new JMenuItem("增加学生");
			/*点击进入增加学生界面*/
			addStuItem.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent e) {
					new AddStudent();
				}
			});
			/*点击进入删除学生界面*/
			delStuItem=new JMenuItem("删除学生");
			delStuItem.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent e) {
					new DelStudent();
				}
			});
			/*点击进入增加班级界面*/
			addClassItem=new JMenuItem("增加班级");
			addClassItem.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent e) {
					new AddClass();
				}
			});
			/*点击进入删除班级界面*/
			delClassItem=new JMenuItem("删除班级");
			delClassItem.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent e) {
					new DelClass();
				}
			});
			/*点击进入增加科目界面*/
			addCourseItem=new JMenuItem("增加科目");
			addCourseItem.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent e) {
					new AddCourse();
				}
			});
			/*点击进入删除科目界面*/
			delCourseItem=new JMenuItem("删除科目");
			delCourseItem.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent e) {
					new DelCourse();
				}
			});
			queryOne=new JMenuItem("查询学生成绩");
			/*点击查询学生成绩*/
			queryOne.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent e) {
					new QueryFrame();
				}
			});
			queryAll=new JMenuItem("查看学生成绩");
			/*点击查看所有学生成绩*/
			queryAll.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent e) {
					new ShowAll();
				}
			});
			/*点击查看班级学生成绩*/
			queryCourse=new JMenuItem("查看班级成绩");
			queryCourse.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent e) {
					new QueryByClass();
				}
			});

			setJMenuBar(menuBar);
			 //添加菜单
			menuBar.add(Student);
			menuBar.add(Class);
			menuBar.add(Subject);
			menuBar.add(Score);
			//添加菜单项目

			Student.add(addStuItem);
			Student.add(delStuItem);
			Class.add(addClassItem);
			Class.add(delClassItem);
			Subject.add(addCourseItem);
			Subject.add(delCourseItem);
			Score.add(queryOne);
			Score.add(queryAll);
			Score.add(queryCourse);			
			
			this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
			setVisible(true);
		 }
	     public static void main(String[]args) {
	  	  new AdminFrame();   	   
	 }
}
